<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
	<title>个人注册</title>
	<link rel="icon" href="./img/favicon.ico">
	<link rel="stylesheet" type="text/css" href="./css/all.css" />
	<link rel="stylesheet" type="text/css" href="./css/pages-register.css" />
	<div th:include="common/head :: head"></div>
</head>

<body>
<!-- 头部栏位 -->
<!--页面顶部-->
<div th:include="common/header :: header"></div>

<div class="register py-container ">
	<!--register-->
	<div class="registerArea">
		<h3>注册新用户<span class="go">我有账号，去<a href="login.html" target="_blank">登陆</a></span></h3>
		<div id="profile" class="info">
			<form class="sui-form form-horizontal">
				<div class="control-group">
					<label class="control-label">用户名：</label>
					<div class="controls">
						<input v-model="user.loginName" type="text" placeholder="请输入你的用户名" class="input-xfat input-xlarge">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">别名：</label>
					<div class="controls">
						<input v-model="user.nickName" type="text" placeholder="请输入你的别名" class="input-xfat input-xlarge">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">手机号：</label>
					<div class="controls">
						<input v-model="user.phoneNum" type="text" placeholder="请输入你的手机号" class="input-xfat input-xlarge">
					</div>
				</div>

				<div class="control-group">
					<label for="inputPassword" class="control-label">登录密码：</label>
					<div class="controls">
						<input v-model="user.passwd" type="password" placeholder="设置登录密码" class="input-xfat input-xlarge">
					</div>
				</div>
				<div class="control-group">
					<label for="inputPassword" class="control-label">确认密码：</label>
					<div class="controls">
						<input v-model="user.passwd2" type="password" placeholder="再次确认密码" class="input-xfat input-xlarge">
					</div>
				</div>
				<div class="control-group">
					<label for="inputPassword" class="control-label">姓名：</label>
					<div class="controls">
						<input v-model="user.name" type="text" placeholder="请输入真实姓名" class="input-xfat input-xlarge">
					</div>
				</div>
				<div class="control-group">
					<label for="inputPassword" class="control-label">邮箱：</label>
					<div class="controls">
						<input v-model="user.email" type="text" placeholder="请输入邮箱" class="input-xfat input-xlarge">
					</div>
				</div>
				<div class="control-group">
					<label for="inputPassword" class="control-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
					<div class="controls">
						<input name="m1" type="checkbox" value="2" checked=""><span>同意协议并注册《尚品汇用户协议》</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label"></label>
					<div class="controls btn-reg">
						<a class="sui-btn btn-block btn-xlarge btn-danger" href="javascript:" @click="submitRegister()">完成注册</a>
					</div>
				</div>
			</form>
			<div class="clearfix"></div>
		</div>
	</div>
	<!--foot-->
	<div class="py-container copyright">
		<ul>
			<li>关于我们</li>
			<li>联系我们</li>
			<li>联系客服</li>
			<li>商家入驻</li>
			<li>营销中心</li>
			<li>手机尚品汇</li>
			<li>销售联盟</li>
			<li>尚品汇社区</li>
		</ul>
		<div class="address">地址：北京市昌平区宏福科技园综合楼6层</div>
		<div class="beian">京ICP备19006430号
		</div>
	</div>
</div>
<script src="/js/api/register.js"></script>
<script th:inline="javascript">
	var item = new Vue({
		el: '#profile',
		data: {
			user: {
				loginName: '',
				passwd: '',
				nickName:'',
				passwd2:'',
				phoneNumber:'',
				email:'',
				realNumber:''
			}
		},
		created() {
		},
		methods: {
			submitRegister() {
				register.register(this.user).then(response => {
					if (response.data.code == 200) {
						if(this.originUrl == ''){
							window.location.href="http://www.gmall.com"
							return ;
						} else {
							window.location.href = decodeURIComponent(this.originUrl)
						}
					}else {
						alert(response.data.data.message)
					}
				})
			}
		}
	})
</script>
</body>
</html>
